package com.sayimo.maker.activity.dao.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.sayimo.framework.database.mybatis.AbstractMybatisBaseDao;
import com.sayimo.framework.exception.DaoException;
import com.sayimo.maker.activity.dao.BaseGroupBuyDao;
import com.sayimo.maker.activity.vo.BaseGroupBuy;

/**
 * @Copyright (C)  广东省尚一互联网有限公司
 * @Project: schoolmallapi
 * @ClassName: BaseGroupBuyDaoImpl
 * @Description: 
 * @author:	wangyang
 * @date:	日期：2016年10月18日  时间：上午10:51:00
 * @version 2.0.0
 */
@Repository(value="baseGroupBuyDao")
public class BaseGroupBuyDaoImpl extends AbstractMybatisBaseDao<BaseGroupBuy> implements BaseGroupBuyDao{

	/** 
	* @Title: selectGroupBuyGoodsList 
	* @Description: 
	* @param goodsType
	* @return
	* @return List<BaseGroupBuy>
	* @throws 
	*/
	@Override
	public List<BaseGroupBuy> selectGroupBuyGoodsList(Integer goodsType)
			throws DaoException {
		Map map=new HashMap();
		map.put("goodsType", goodsType);
		return this.mybatisInterfaceBaseDao.query("com.sayimo.maker.activity.dao.BaseGroupBuyDao.selectGroupBuyGoodsList", map);
	}

	/** 
	* @Title: selectGroupBuyPreGoodsList 
	* @Description: 
	* @param goodsType
	* @return
	* @return List<BaseGroupBuy>
	* @throws 
	*/
	@Override
	public List<BaseGroupBuy> selectGroupBuyPreGoodsList(Integer goodsType)
			throws DaoException {
		Map map=new HashMap();
		map.put("goodsType", goodsType);
		return this.mybatisInterfaceBaseDao.query("com.sayimo.maker.activity.dao.BaseGroupBuyDao.selectGroupBuyPreGoodsList", map);
	}

	/** 
	* @Title: selectBaseGroupBuyIdentifier 
	* @Description: 
	* @param identifier
	* @return
	* @return Map<String,Object>
	* @throws 
	*/ 
	@Override
	@SuppressWarnings({ "rawtypes"})
	public Map<String, Object> selectBaseGroupBuyIdentifier(String identifier)
			throws DaoException {
		return this.mybatisInterfaceBaseDao.queryMap("com.sayimo.maker.activity.dao.BaseGroupBuyDao.selectBaseGroupBuyIdentifier","identifierCn", identifier);
	}

	/** 
	* @Title: queryGroupBuyGoodsInfoByGoodsId 
	* @Description: 
	* @param goodsId
	* @param identifier
	* @return
	* @return Map<String,Object>
	* @throws 
	*/
	@Override
	public Map<String, Object> queryGroupBuyGoodsInfoByGoodsId(Integer goodsId,
			String identifier) throws DaoException {
		Map map=new HashMap();
		map.put("goodsId", goodsId);
		map.put("identifier", identifier);
		return (Map<String, Object>) this.mybatisInterfaceBaseDao.getObject("com.sayimo.maker.activity.dao.BaseGroupBuyDao.queryGroupBuyGoodsInfoByGoodsId", map);
	}

	/** 
	* @Title: queryOverDueGroupBuyidentifier 
	* @Description: 处理已过期的团购活动
	* @return
	* @return String
	* @throws 
	*/ 
	@Override
	public List queryOverDueGroupBuyidentifier() throws DaoException {
		return this.mybatisInterfaceBaseDao.queryObject("com.sayimo.maker.activity.dao.BaseGroupBuyDao.queryOverDueGroupBuyidentifier", null);
//		return  this.mybatisInterfaceBaseDao.getObject("com.sayimo.maker.activity.dao.BaseGroupBuyDao.queryOverDueGroupBuyidentifier", null);		
	}

	/** 
	* @Title: queryIdentifiersByNormal 
	* @Description: 
	* @return
	* @return String
	* @throws 
	*/ 
	@Override
	public String queryIdentifiersByNormal() throws DaoException {
		
		return (String) this.mybatisInterfaceBaseDao.getObject("com.sayimo.maker.activity.dao.BaseGroupBuyDao.queryIdentifiersByNormal", null);
	}

	/** 
	* @Title: queryInfoByIdentifierPreGoods 
	* @Description: 
	* @return
	* @return String
	* @throws 
	*/ 
	@Override
	public Map queryInfoByIdentifierPreGoods(String identifier) throws DaoException {
		Map map=new HashMap();
		map.put("identifier", identifier);
		return (Map<String, Object>) this.mybatisInterfaceBaseDao.getObject("com.sayimo.maker.activity.dao.BaseGroupBuyDao.queryInfoByIdentifierPreGoods", map);
	}

	/** 
	* @Title: queryInfoByIdentifierGoods 
	* @Description: 
	* @return
	* @return String
	* @throws 
	*/
	@Override
	public Map queryInfoByIdentifierGoods(String identifier)
			throws DaoException {
		Map map=new HashMap();
		map.put("identifier", identifier);
		return (Map<String, Object>) this.mybatisInterfaceBaseDao.getObject("com.sayimo.maker.activity.dao.BaseGroupBuyDao.queryInfoByIdentifierGoods", map);
	}

	@Override
	public Integer updateStatusByIdentifier(String identifier)
			throws DaoException {
		
		return this.mybatisInterfaceBaseDao.update("com.sayimo.maker.activity.dao.BaseGroupBuyDao.updateStatusByIdentifier", identifier);
	}

}
